package com.github.postsanf.yinian.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.github.postsanf.yinian.R;
import com.github.postsanf.yinian.largeImageView.InputStreamBitmapDecoderFactory;
import com.github.postsanf.yinian.largeImageView.LargeImageView;

import java.io.IOException;

public class PcIntroduceActivity extends AppCompatActivity {
    private ImageView ic_back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pc_introduce);
        LargeImageView iv_pc = (LargeImageView) findViewById(R.id.iv_pc);
        TextView tv_title = (TextView) findViewById(R.id.tv_title);
        ic_back = ((ImageView) findViewById(R.id.ic_back));
        ic_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        String weixin = getIntent().getStringExtra("weixin");
        if (weixin != null && weixin.equals("weixin")) {
            try {
                tv_title.setText("微信端共享照片");
                iv_pc.setImage(new InputStreamBitmapDecoderFactory((getAssets().open("weiixn_introduce.jpg"))));
            } catch (IOException e) {
                e.printStackTrace();
            }
        } else {
            try {
                iv_pc.setImage(new InputStreamBitmapDecoderFactory((getAssets().open("pc_introduce.jpg"))));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
